/*
 * @Author: your name
 * @Date: 2020-09-24 14:11:36
 * @LastEditTime: 2020-12-16 17:08:34
 * @LastEditors: lxc
 * @Description: In User Settings Edit
 * @FilePath: \vue3\src\store\index.ts
 */
import { createStore } from 'vuex'

export default createStore({
    state: {
    },
    getters: {
        allTime: () => {
            return 0
        },
        token: () => {
            return localStorage.getItem('token')
        }
    },
    mutations: {
        userToken: (state: any, token: string) => {
            if (token) {
                state.token = token;
            }
        }
    },
    actions: {
        setToken: ({ commit }: any, token: string) => {
            commit('userToken', token);
        }
    },
    modules: {
    }
})
